// Learn TypeScript:
//  - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
export default class IdGenerator {
    private _id: number = null;
    private _key: string = null;
    constructor(key: string = "default") {
        this._key = key;
        this._id = 0;
    }

    public genId(): string {
        this._id++;
        return this._key + ":" + this._id;
    }

    public reset() {
        this._id = 0;
    }
}
